/**
 *区域查询
 */
'use strict';

const conn = require('../../libs/DB/Conn');


module.exports = async function (params) {
    let querySql =`SELECT
                        rf.range_id AS rangeId,
                        rf.range_name AS rangeName,
                        uf.user_name AS userName,
                        uf.mobile
                    FROM
                    range_file rf 
                        LEFT JOIN user_file uf ON uf.user_id = rf.user_id
                    WHERE
                    rf.delete_sign = 1
                    ${params.parentId ? `AND parent_id = ${params.parentId}` : "AND parent_id = 0"}`
    let rangeList =  await conn(querySql);
    return { success: true ,rangeList:rangeList};
};